<? FoundryView::includeTpl( 'global:header' ) ?>
<?php FoundryController::model( 'net.mode3.news:comment' ); ?>
<div id="content_area_leftInternal">

	<h1><?=$this->data['post']->headline?></h1>
	<h2><?=$this->data['post']->subhead?></h2>

	<?=$this->data['post']->content_markdown?>

<?php if( $this->data['post']->allow_comments ) : ?>
	<h3>They said</h3>
	<?php foreach( $this->data['post']->comments as $comment ) : ?>
		<?php if( $this->data['allowModerate'] === true && !$comment->published) : ?>
			<a href="<?php echo FoundryView::helperLinkTo( 'news/publishComment/'.$this->data['post']->uid.'/'.$comment->uid ) ?>">Publish</a>
		<?php endif ?>
		<?php echo $comment->comment ?><p />
	<?php endforeach ?>

	Leave a comment!<p />
	
	<form method="post" action="<?php echo FoundryView::helperLinkTo( 'news/postComment/'.$this->data['post']->uid ) ?>">
	<b>Your name:</b> (optional)<br />
	<input type="text" name="name" /><p />
	
	<b>Your email:</b> (optional)<br />
	<input type="text" name="email" /><p />
	
	<b>Whatchu got to say about it?</b><br />
	<textarea rows="5" cols="40" name="comment"></textarea><p />
	
	<?php if( $this->data['post']->challenge && $this->data['post']->response ) : ?>
		<?php if( $this->data['error'] == 'failedChallenge' ) : ?>
			You didn&#039;t properly answer the question below!<p />
		<?php endif ?>
		<b>Please answer the following question:</b><br />
		<?php echo $this->data['post']->challenge ?><br />
		<input type="text" name="response" /><p />
	
	<?php endif ?>
	
	<input type="submit" value="Post my comment" />
	
	</form>	

<?php endif ?>

</div><!-- content_area_left -->


<? FoundryView::includeTpl( 'global:footer' ) ?>